/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import { Request, Response } from 'express';
import Mock from 'mockjs';
const { mock } = Mock;

const defaultResponse = (req: Request, res: Response) => {
  res.send({
    code: 0,
    msg: 'message',
  });
};

export default {
  'POST /InvoiceManage/invoiceList': (req: Request, res: Response) => {
    const status = req.body.status;
    res.send(
      mock({
        code: 0,
        msg: 'success',
        data: {
          'result|5-20': [
            {
              id: '@id',
              invoice_id: '@id',
              status: status,
              'type|1': ['company', ''],
              'title|1': ['上海通递驿优网络技术有限公司', ''],
              tax_number: '91310105ma1fwdag7y',
              remark: '@cword(3, 7)',
              content: '@cword(3, 7)',
              mobile: /1[3-9]\d{9}$/,
              email: '@url',
              total_price: '@float(1, 10, 0, 2)',
              drawer: '快宝网络科技有限公司',
              is_sync_mina: '0',
              gd_pdf_url: '//img.kuaidihelp.com/xyt/qrcode.png',
              create_at: '@datetime',
              ticket_sn: '@id',
              'fail_reasons|1-10': [
                {
                  id: '@id',
                  wkd_invoice_id: '@id',
                  code: '@id',
                  reason: '@cword(7, 10)',
                  created_at: '@datetime',
                },
              ],
              company_address: '公司地址',
              company_tel: '公司电话',
              bank_name: '开户行',
              bank_account: '银行账户',
              'source|1': ['wkd', 'regiment'],
            },
          ],
          'total|20-100': 100,
        },
      }),
    );
  },
  'POST /OpenInvoiceDo/gdInvoice': defaultResponse,
  'POSt /OpenInvoiceDo/multiGdInvoice': defaultResponse,
  'POST /InvoiceManage/deleteInvoiceOrder': defaultResponse,
  'POST /invoice/applicantsData': (req: Request, res: Response) => {
    const status = req.body.type;
    res.send(
      mock({
        code: 0,
        msg: 'success',
        data: {
          'result|5-20': [
            {
              id: '@id',
              created_at: '@datetime',
              index_shop_id: '@id',
              'invoice_type|1': ['1', '2'],
              index_shop_name: '@cword(3, 7)',
              invoice_title: '@cword(3, 7)',
              email: '@url',
              total_money: '@float(1, 10, 0, 2)',
              receiver_tel: /1[3-9]\d{9}$/,
              message: '@cword(3, 7)',
              ticket_sn: '@id',
              'pdf_url|1': ['//img.kuaidihelp.com/xyt/qrcode.png', ''],
              status: status,
              shop_info_id: '@id',
              comment: '@cword(3, 7)',
              receiver_name: '@cname',
              receiver_address: '@county(true)',
              'admin_commnet|1': ['拒绝原因', ''],
            },
          ],
          'total|20-100': 100,
        },
      }),
    );
  },
  'POST /invoice/getShopInfo': (req: Request, res: Response) => {
    res.send(
      mock({
        code: 0,
        msg: 'success',
        data: {
          id: '1',
          index_shop_id: '990',
          invoice_title: '2121',
          taxpayer_unionid: '144333',
          bank_name: '123',
          bank_account: '123',
          company_address: '123',
          contact: '123',
          license_url:
            'http://upload.kuaidihelp.com/wdadmin/shop_invoice_info/s_990/990_20200729104556.jpg',
          qualification_url:
            'http://upload.kuaidihelp.com/wdadmin/shop_invoice_info/s_990/990_20200729104559.jpg',
          type: '1',
          created_at: '2018-04-26 16:24:01',
          license_name: '990_20200729104556.jpg',
          qualification_name: '990_20200729104559.jpg',
        },
      }),
    );
  },
  'POST /OpenInvoice/gdInvoice': defaultResponse,
  'POST /invoice/applicantUpdate': defaultResponse,
};
